import Cookies from 'js-cookie';

const TokenKey = 'AdminToken'

export function getAdminToken () {
  return Cookies.get(TokenKey)
}

export function setAdminToken (token: string) {
  return Cookies.set(TokenKey, token, {expires: 100})
}

export function removeAdminToken () {
  return Cookies.remove(TokenKey)
}

export function setIsAdmin(flag: boolean) {
  return Cookies.set('isAdmin', flag? "1":"", {expires: 100})
}

export function getIsAdmin () {
  return Cookies.get('isAdmin')
}

export function setAppToken(appSymbol: string,token: string) {
  if (appSymbol) {
    return Cookies.set(`${appSymbol}-AppToken`, token, {expires: 100})
  } else {
    return Cookies.set('AppToken', token, {expires: 100})
  }
}



